<?php
/**
 *  Pictures.php Created by : PhpStorm
 *
 * @author: 魏巍 <524314430@qq.com>
 * @date  : 2021/9/22 17:09
 */

namespace app\api\controller;

use Curl\Curl;
use think\App;

class Ivs extends Base
{
    /**
     * 请求代理
     *
     * @param string $url
     * @param string $post_data
     * @param string $jssesionId
     *
     * @return \think\response\Json
     */
    public function proxy($url = '', $post_data = '', $jssesionId='')
    {
        $_post_url = 'http://120.79.137.194:52467/openApi' . $url;
//        $result = $this->_curl($_post_url,$post_data, $jssesionId);
        $curl = new Curl();
        $curl->setHeader('Content-type', 'application/json;charset=UTF-8;');
        $curl->setHeader('Origin', 'http://120.79.137.194:52467');
        if($jssesionId){
            $curl->setHeader('jssesionId', $this->request->header('jssesionid'));
        }
        if($post_data){
            $curl->post($_post_url, $post_data, true);
        }else{
            $curl->post($_post_url, $post_data);
        }
        $result = json_decode($curl->response, true);
        return json($result);
    }
}
